1. Field of the Invention
The present invention relates to an image encoding/decoding method for encoding/decoding a video or still image and an apparatus therefor.
2. Description of the Related Art
In recent years, a video encoding method that the encoding efficiency is improved more largely than before is recommended for ITU-TRec.H.264 and ISO/IEC14496-10 in conjunction with ITU-T and ISO/IEC. A conventional encoding system such as ISO/IECMPEG-1,2,4, ITU-TH.261, H.263 performs compression with two-dimensional discrete cosine transformation (DCT) of a 8*8 block. In contrast, since an encoding system of H.264 uses two-dimensional integer orthogonal transformation of a 4*4 block, it needs not consider IDCT mismatch, and make it possible to carry out an operation with a 16-bit register.
Also, the H.264 encoding system makes it possible to recognize an orthogonal transformation process and a quantization process by addition and bit shift. A dequantization process and an inverse integer orthogonal transformation process can be realized by addition and bit shift like the orthogonal transformation and quantization process.
Further, in H.264, development of a profile including a new encoding tool is progressed in order to realize improvement of an encoding efficiency or a subjective image quality for a high-resolution image such as a high-definition television image. In, for example, High profile (Joint Video Team (JVT) of ISO/IEC MPEG & ITU-T VCEG, 12th Meeting: Redmond, Wash., USA 17-23 Jul., 2004, “JVT-L047d8”) of H.264, it is expected that a quantization matrix technology (ISO/IEC 13818-2: 2000 Information technology—Generic coding of moving pictures and associated audio information: Video) such as two-dimensional integer orthogonal transformation of a 8*8 block or a MPEG-2 is introduced, and a profile directed to a high-resolution image and a subjective image quality is provided.
A general quantization process in image encoding is done based on the following equation (1).
                              X          ij                =                              int            ⁡                          (                                                                                                              Y                      ij                                                                            +                  f                                                  Q                  step                                            )                                ·                      sgn            ⁡                          (                              Y                ij                            )                                                          (        1        )            
where Xij indicates a quantized transformation coefficient matrix, Qstep a quantization step, and Yij a transformation coefficient matrix. On the other hand, the general dequantization process is done based on the following equation (2).Y′ij=Xij×Qstep  (2)
In H.264, the dequantization shown by the following equation is done to realize an operation precision of 16-bit with a little operation. For example, the dequantization process (an error signal of a 4*4 pixel block) of a H.264 High profile is shown in the following equation (3).Yij=Xij×LS(m,i,j)<<(QP/6)  (3)
where a level scale LS(m, i, j) is a value defined by the following equation (4), and QP is a quantization parameter indicating a value in a range from 0 to 51.LS(m,i,j)=WS(i,j)×Norm(m,i,j)  (4)
Norm(m, i, j) indicates a scale adjustment parameter expressed by the equation (5), and each element is expressed by the equation (6).
                              Norm          (                                          ⁢                      m            ,                                                  ⁢            i            ,                                                  ⁢            j                    )                =                                  ⁢                  {                                          ⁢                                                                      v                                      m                    ,                    0                                                                                                                                          for                      ⁢                                                                                          ⁢                                              (                                                  i                          ,                          j                                                )                                                              =                                          {                                                                        (                                                      0                            ,                            0                                                    )                                                ,                                                  (                                                      0                            ,                            2                                                    )                                                ,                                                  (                                                      2                            ,                            0                                                    )                                                ,                                                  (                                                      2                            ,                            2                                                    )                                                                    }                                                        ,                                                                                                      v                                      m                    ,                    1                                                                                                                                          for                      ⁢                                                                                          ⁢                                              (                                                  i                          ,                          j                                                )                                                              =                                          {                                                                        (                                                      1                            ,                            1                                                    )                                                ,                                                  (                                                      1                            ,                            3                                                    )                                                ,                                                  (                                                      3                            ,                            1                                                    )                                                ,                                                  (                                                      3                            ,                            3                                                    )                                                                    }                                                        ,                                                                                                      v                                      m                    ,                    2                                                                                                otherwise                  ;                                                                                        (        5        )                                          v          mn                =                  [                                                    10                                            16                                            13                                                                    11                                            18                                            14                                                                    13                                            20                                            16                                                                    14                                            23                                            18                                                                    16                                            25                                            20                                                                    18                                            29                                            23                                              ]                                    (        6        )            
Further, WS(i, j) represents a quantization matrix, and can select the matrix expressed by, for example, equation (7).
                              WS          ⁡                      (                          i              ,              j                        )                          =                  [                                                    6                                            12                                            20                                            27                                                                    12                                            20                                            27                                            32                                                                    20                                            27                                            32                                            37                                                                    27                                            32                                            37                                            41                                              ]                                    (        7        )            
In H.264, the QP value (quantization parameter) of the equation (3) is prescribed so as to have the same value in the macroblock. The High profile can take two kinds of conversion block sizes of a 4*4 block and a 8*8 block. At the same time, the quantization process can be done with two kinds of quantization bock sizes of the 4*4 block and 8*8 block.
For example, the intra-prediction of H.264 has nine modes for each of the 4*4 block and the 8*8 block and four modes for a 16*16 block. The distribution of the transformation coefficients obtained by subjecting to orthogonal transformation the predictive error occurring according to the prediction mode or the block size differs for every block. Similarly, in the inter-prediction, it is possible to select an arbitrary block from blocks of seven kinds of motion compensation block sizes. There are a great number of combinations of predictions due to the motion vectors provided from a plurality of reference images. Therefore, since a predictive block size and a reference image differ from each other in the macroblock, the distribution of the transformation coefficients obtained by subjecting the predictive error to orthogonal transformation is apt to differ for every block.
Further, in H.264, the quantization matrix can be changed for every sequence or every picture. Since the quantization matrix contributes in particular to improvement of a subjective image quality greatly, it is important to design an optimum matrix according to an image to be encoded. However, the matrix is originally weighted to coefficient distribution in a frequency domain, so that the optimum matrix differs for every pixel region when the coefficient distribution differs for every block.
As discussed above, in H.264, the dequantizer can not be changed according to a predictive block shape in the macroblock and a prediction mode. Accordingly, there is a problem that transformation coefficients in a small pixel block in the macroblock cannot be finely controlled.
Further, when a quantization parameter is determined and dequantized for every macroblock by a method prescribed in the H.264 High profile, using a given quantization matrix, there is a problem that it is impossible to control transformation coefficients according to a predictive block shape in the macroblock and a prediction method.
The object of the present invention is to provide a video encoding method for encoding an image by quantizing a predictive error signal in units of a block smaller than a macroblock referring to a quantization code table.